package com.limm.service;

import com.limm.cloud01.entity.Dept;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
public class DeptClientServiceFallbackFactory implements FallbackFactory {
    @Override
    public FeignDeptService create(Throwable throwable) {

        return new FeignDeptService() {
            @Override
            public Dept selectByID(Long dept_no) {

                return new Dept().setDeptNo(dept_no)
                        .setDeptName("id-->"+dept_no+": 没有对应的信息，客户端提供了降级的信息，这个服务现在已经降级了")
                        .setDbResource("no database")
                        ;
            }

            @Override
            public List<Dept> findAll() {
                return null;
            }
        };
    }
}
